package designMode.observerPattern_api;

import designMode.observerPattern.Observer;
import designMode.observerPattern.Subject;

import java.util.ArrayList;
import java.util.Observable;

/**
 * @ClassName WeatherData
 * @Description
 * @Author LIBOFEI
 * @Date 2020/6/14 18:52
 * @Version 1.0
 **/

public class WeatherData extends Observable {

    private float temperature;
    private float humidity;
    private float pressure;


    public void measurementsChanged(){
        setChanged();
        notifyObservers();
    }

    public void setMeasurements(float temperature,float humidity,float pressure){
        this.temperature = temperature;
        this.humidity = humidity;
        this.pressure = pressure;
        measurementsChanged();
    }

    public void setHumidity(float humidity) {
        this.humidity = humidity;
    }

    public float getHumidity() {
        return humidity;
    }

    public void setPressure(float pressure) {
        this.pressure = pressure;
    }

    public float getPressure() {
        return pressure;
    }

    public void setTemperature(float temperature) {
        this.temperature = temperature;
    }

    public float getTemperature() {
        return temperature;
    }
}
